/************************************************************************/
/* Game                                                                 */
/************************************************************************/
#include "Game/Game Objects/Towers/LakituTower.h"

namespace TD_Game {


	/************************************************************************/
	/* Flower tower definitions                                             */
	/************************************************************************/

	const int LakituTower::shootingInterval[NUMBER_OF_LEVELS] =				{750, 750, 750, 750, 750, 750};
	const unsigned int LakituTower::towerRadius[NUMBER_OF_LEVELS] =			{125, 150, 150, 175, 175, 200};
	const unsigned int LakituTower::towerDamage[NUMBER_OF_LEVELS] =			{8, 18, 37, 56, 85, 135};
	const unsigned int LakituTower::towerPrice[NUMBER_OF_LEVELS] =			{5, 10, 20, 40, 80, 130};
	const unsigned int LakituTower::towerValue[NUMBER_OF_LEVELS] =			{5, 10, 16, 40, 60, 70};
	const string LakituTower::towerName = "Torre Lakitu";


	const LakituTower *LakituTower::m_pStaticReference = NULL;
	shared_ptr<SDLSound> LakituTower::m_pHittedSound = shared_ptr<SDLSound>();

	/************************************************************************/
	/* Protected functions                                                  */
	/************************************************************************/
	void LakituTower::initBaseValues() {
		for(unsigned int i = 0; i < NUMBER_OF_LEVELS; i++) {
			m_shootingInterval[i] = shootingInterval[i];
			m_towerDamage[i] = towerDamage[i];
			m_towerRange[i] = towerRadius[i];
			m_towerPrice[i] = towerPrice[i];
			m_towerValue[i] = towerValue[i];
		}
		m_towerName = towerName;

		m_pDescriptionTile = new Tile(Coord2D(0.81191*screenWidth, 0.375*screenHeight), Coord2D(184, 74), 
			imgTile, TD_Resources::ResourceManager::loadImage("GUI/Descriptions/lakituTowerDescription.png", Color::PINK));
		m_baseTowerType = lakituTower_lvl1;
		m_baseShotType = spineShell_lvl1;
		//Upgrade bar displacement
		m_upBarDisplacement = Coord2D(-15, 25);
	}

	/************************************************************************/
	/* ctors and dtors                                                      */
	/************************************************************************/

	LakituTower::LakituTower() {
		initBaseValues();
	}

	LakituTower::LakituTower(const LakituTower & rhs) {

	}

	LakituTower & LakituTower::operator=(const LakituTower &rhs) {
		BaseTower::operator=(rhs);
		return(*this);
	}

	LakituTower::LakituTower(unsigned int g_ID, const Coord2D & turretPosition) : BaseTower (g_ID, turretPosition) {

		initBaseValues();

		m_pAnimationSet = AnimationSetFactory::createTowerAnimationSet(m_baseTowerType, "Idle");
		m_pBaseShotAS = AnimationSetFactory::createShotAnimationSet(m_baseShotType, "Moving");

		m_shapes.push_back(new RectangleShape(turretPosition - m_pAnimationSet->getSprites()->getTilesize()/2, m_pAnimationSet->getSprites()->getTilesize()));
	}

	LakituTower::~LakituTower() {

	}
}